
import 'package:elmer_tools/common/dataBase/ColumnType.dart';

class TypeString implements ColumnType<String> {
    @override
    String? defaultValue;

    @override
    String name;

    @override
    bool? notNull;

    @override
    bool? primaryKey;

    @override
    bool? unique;

    @override
    String? comment;

    int length;

    @override
    String get type {
        String result = name;
        if(length > 0) {
            result += " VARCHAR($length)";
        }
        if(notNull == true) {
            result += " NOT NULL";
        }
        if(primaryKey == true) {
            result += " PRIMARY KEY";
        }
        return result;
    }
    
    TypeString(
        this.name,
        {
            this.defaultValue,
            this.length = 0,
            this.notNull = false,
            this.unique = false,
            this.primaryKey = false,
        }
    );
  
}